Fixes for mapbar, mapsource.
authorrobertlipe <robertlipe@gmail.com>
Wed, 1 Jan 2014 06:47:17 +0000 (06:47 +0000)
committerrobertlipe <robertlipe@gmail.com>
Wed, 1 Jan 2014 06:47:17 +0000 (06:47 +0000)
gpsbabel/mapbar_track.cc
gpsbabel/mapsource.cc

index e74739bf63b40baa16b3dd650f241fe2c55ef6c4..daa24ced3766ddc777c0769ca37c7d39c1ca448f 100644 (file)
@@ -93,7 +93,9 @@ mapbar_track_read(void)
   // At this point, name is a UCS-16 encoded, zero terminated string.
   // All our internals use UTF-8 encoding, so convert now.
   int olen = strlen(name);
-  track->rte_name = cet_str_uni_to_utf8((const short int*) name, olen);
+
+  QScopedPointer<char, QScopedPointerPodDeleter>rte_name (cet_str_uni_to_utf8((const short int*) name, olen));
+  track->rte_name = rte_name.take();
 
   // skip two pair waypoint
   gbfseek(fin, 8*4, SEEK_CUR);
index 687d90faad8d7260a8eb2ec27323e00195df65c6..ab8acb849eeff7bb1bfdac6ea9b86be970587545 100644 (file)
@@ -580,13 +580,13 @@ mps_waypoint_r(gbfile* mps_file, int mps_ver, waypoint** wpt, unsigned int* mpsc
   if ((mps_ver == 4) || (mps_ver == 5)) {
     gbfread(tbuf, 6, 1, mps_file);                             /* unknown */
     QScopedPointer<char, QScopedPointerPodDeleter>wptnotes (gbfgetcstr(mps_file));
-    thisWaypoint->notes = *wptnotes;
+    thisWaypoint->notes = wptnotes.take();
   } else {
     gbfread(tbuf, 2, 1, mps_file);                             /* unknown */
   }
 
   thisWaypoint->shortname = wptname;
-  thisWaypoint->description = *wptdesc;
+  thisWaypoint->description = wptdesc.take();
   thisWaypoint->latitude = GPS_Math_Semi_To_Deg(lat);
   thisWaypoint->longitude = GPS_Math_Semi_To_Deg(lon);
   thisWaypoint->altitude = mps_altitude;
@@ -959,7 +959,7 @@ mps_route_r(gbfile* mps_file, int mps_ver, route_head** rte)
 #endif
 
   rte_head = route_head_alloc();
-  rte_head->rte_name = *rtename;
+  rte_head->rte_name = rtename.take();
   route_add_head(rte_head);
   *rte = rte_head;
 
@@ -1563,7 +1563,7 @@ mps_track_r(gbfile* mps_file, int mps_ver, route_head** trk)
 #endif
 
   track_head = route_head_alloc();
-  track_head->rte_name = *trkname;
+  track_head->rte_name = trkname.take();
   track_add_head(track_head);
   *trk = track_head;